﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ERPConnect.Utils;
using ERPConnect;
namespace Ext.Connector.EIS
{
    public class SAPSD
    {
 


        public static void OpenSalesOrderByIDinSAP(string orderID, R3Connection connection)
        {
            Transaction trans = new Transaction();

            //Please assign a valid R3Connection object to the Transaction object
            trans.Connection=connection;
            trans.TCode = "VA03";

            trans.ExecutionMode = ERPConnect.Utils.TransactionDialogMode.ShowOnlyErrors;
            //Begin a new Dynpro
            trans.AddStepSetNewDynpro("SAPMV45A", "0102");

            trans.AddStepSetOKCode(" ");
            trans.AddStepSetCursor("VBAK-VBELN");
            trans.AddStepSetField("VBAK-VBELN", orderID);

/*            //Begin a new Dynpro
            trans.AddStepSetNewDynpro("SAPMV45A", "4001");
            trans.AddStepSetOKCode("/EBABA");*/

            try
            {
                trans.Execute();
                connection.Close();
            }
            catch (Exception ex)
            {
                
                //throw;
            }

        }
    }
}
